-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(neon_http_client): Add AuthenticationInterceptor #2454
feat(neon_http_client): Add AuthenticationInterceptor #2454
Conversation
4e41991
to
bd83703
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2454 +/- ##
==========================================
+ Coverage 29.92% 29.94% +0.02%
==========================================
Files 332 333 +1
Lines 124414 124456 +42
==========================================
+ Hits 37231 37273 +42
Misses 87183 87183
*This pull request uses carry forward flags. Click here to find out more.
|
I'm not so happy with the name of the interceptor, let me know if there is something more fitting. |
packages/neon_framework/packages/neon_http_client/lib/src/neon_http_client.dart
Outdated
Show resolved
Hide resolved
...eon_framework/packages/neon_http_client/lib/src/interceptors/authentication_interceptor.dart
Outdated
Show resolved
Hide resolved
packages/neon_framework/packages/neon_http_client/test/neon_http_client_test.dart
Outdated
Show resolved
Hide resolved
packages/neon_framework/packages/neon_http_client/lib/src/neon_http_client.dart
Outdated
Show resolved
Hide resolved
...eon_framework/packages/neon_http_client/lib/src/interceptors/authentication_interceptor.dart
Outdated
Show resolved
Hide resolved
...eon_framework/packages/neon_http_client/lib/src/interceptors/authentication_interceptor.dart
Outdated
Show resolved
Hide resolved
...eon_framework/packages/neon_http_client/lib/src/interceptors/authentication_interceptor.dart
Outdated
Show resolved
Hide resolved
bd83703
to
685a517
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you test that this also work together with the nextcloud package?
I think 401 responses are thrown so the response interceptor wouldn't ever be used.
packages/neon_framework/packages/neon_http_client/test/neon_http_client_test.dart
Outdated
Show resolved
Hide resolved
packages/neon_framework/packages/neon_http_client/lib/src/neon_http_client.dart
Show resolved
Hide resolved
...eon_framework/packages/neon_http_client/lib/src/interceptors/authentication_interceptor.dart
Outdated
Show resolved
Hide resolved
...eon_framework/packages/neon_http_client/lib/src/interceptors/authentication_interceptor.dart
Outdated
Show resolved
Hide resolved
You're thinking on the wrong layer. The response interceptor comes way before the response is parsed in the nextcloud package and an exception might be thrown. |
685a517
to
1e6a8ae
Compare
1e6a8ae
to
a3571b2
Compare
Maybe |
a3571b2
to
4bf824d
Compare
...eon_framework/packages/neon_http_client/lib/src/interceptors/authentication_interceptor.dart
Outdated
Show resolved
Hide resolved
...eon_framework/packages/neon_http_client/lib/src/interceptors/authentication_interceptor.dart
Outdated
Show resolved
Hide resolved
Yep. I mixed something up in my head.
I'm not sure about the naming and don't have any opinion on it. What about |
It still doesn't really convey what it is doing. I think something like |
…ptionException during interception Signed-off-by: provokateurin <[email protected]>
Signed-off-by: provokateurin <[email protected]>
4bf824d
to
114487b
Compare
Closes #365
Quite simple to implement with our interceptors 😄
Every Account gets it's own NeonHttpClient and therefore it's own AuthenticationInterceptor, so no separation is required.
I removed the catch handlers because the interceptor needs to be able to throw an exception for requests that need to be blocked.